$(document).ready(function(e){
	$(".scroll").click(function(event){
		event.preventDefault();
		$('html,body').animate({scrollTop:$(this.hash).offset().top},1200);
	});
	try {
		$("body select").msDropDown();
	} catch(e) {
		alert(e.message);
	}
});
// You can also use "$(window).load(function() {"
$(function () {
	// Slideshow 1
	$("#slider1").responsiveSlides({
	maxwidth: 1600,
	speed: 600
	});
});
function numbersonly(myfield, e, dec){
	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
		return true;
	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
		return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
		return true;
	// decimal point jump
	else if (dec && (keychar == ".")){
		myfield.form.elements[dec].focus();
		return false;
	}else
		return false;
}
function checkEmail(sEmail) {
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(sEmail)) {
        return false;
    }
    return true;
}
function checkNumber(txtNo){
	var arr = ["091", "094", "0120","0121","0122","0123","0124","0125","0126","0127","0128","0129","090", "093","098", "097", "096", "0162", "0163", "0164", "0165", "0166", "0167", "0168", "0169", "092", "0188", "0186","095","0199","099"];
	if(txtNo.length > 10)
		txtNo = txtNo.substring(0,4);
	else
		txtNo = txtNo.substring(0,3);
	return ($.inArray(txtNo, arr) > -1);
}
function formatToVND(AmountX){
	var Amount = AmountX + '';
	var result = '';
	var j = 0;
	if (Amount.length > 3){
		for (i = (Amount.length - 1); i >= 0; i--){
			j++;
			result = Amount.charAt(i) + result;
			if (j >= 3){
				j = 0;
				if (i!=0)
				result = '.' + result;
			}
		}
		return result;
	}
	else{  
		return Amount;
	}
}